package com.huichaoliu.adapters;

import com.huichaoliu.app.R;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.Toast;

public class StylistDetailHelpAdapter extends BaseAdapter {

	private Context mContext = null;

	public StylistDetailHelpAdapter(Context mContext) {
		this.mContext = mContext;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 11;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(mContext).inflate(R.layout.item_help_comment, null);
		}
		LinearLayout layout_comments = (LinearLayout) convertView.findViewById(R.id.layout_comments);
		layout_comments.removeAllViews();
		for (int i = 0; i < 4; i++) {
			View viewComment = LayoutInflater.from(mContext).inflate(R.layout.item_photo_comment, null);
			layout_comments.addView(viewComment);
		}
		convertView.findViewById(R.id.btn_match).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				((Activity) mContext).setResult(Activity.RESULT_OK);
				((Activity) mContext).finish();
			}
		});
		convertView.findViewById(R.id.btn_buy).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Toast.makeText(mContext, "已加入购物车", 0).show();
			}
		});
		return convertView;
	}

}
